package com.xufei.auth.controller;

import com.xufei.auth.service.TokenService;
import com.xufei.common.domain.common.AjaxJson;
import com.xufei.common.domain.user.User;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("auth")
public class TokenController
{

    private final TokenService tokenService;

    public TokenController(TokenService tokenService) {
        this.tokenService = tokenService;
    }

    @PostMapping("login")
    public AjaxJson login(String userName, String passWord)
    {
        // 用户登录 获取登录token
        User user = tokenService.login(userName,passWord);
        return  AjaxJson.data(user);
    }
}
